<script type="text/javascript" language="javascript">
    const reductionPrincipalId = WfForm.convertFieldNameToId("jmbj");
    var overdueDaysId = WfForm.convertFieldNameToId("dqyqts");
    var cutInterestRateId = WfForm.convertFieldNameToId("jmlx");
    var repaymentInterestId = WfForm.convertFieldNameToId("hklx");
    var overdueAmountId = WfForm.convertFieldNameToId("sqjmje");
    var reductionPrincipal = WfForm.getFieldValue(reductionPrincipalId);
    var overdueDays = WfForm.getFieldValue(overdueDaysId);
    var cutInterestRate = WfForm.getFieldValue(cutInterestRateId);
    var repaymentInterest = WfForm.getFieldValue(repaymentInterestId);
    var overdueAmount = WfForm.getFieldValue(overdueAmountId);
    WfForm.bindFieldChangeEvent(reductionPrincipalId + "," + overdueDaysId + "," + cutInterestRateId + "," + repaymentInterestId + "," + overdueAmountId,
        function (obj, id, value) {
            //********************************************************
            window.ecCom.WeaTools.callApi("/interface/gsw/RequiredControl.jsp?reductionPrincipal=" + reductionPrincipal +
                "&overdueDays=" + overdueDays +
                "&cutInterestRate=" + cutInterestRate +
                "&repaymentInterest=" + repaymentInterest +
                "&overdueAmount=" + overdueAmount,
                "GET", {})
                .then(item => {
                    //获取返回值
                    var RiskDepartmentHead = item.RiskDepartmentHead;
                    var AssetDisposalCommittee = item.AssetDisposalCommittee;
                    var GeneralManager = item.GeneralManager;
                    var RiskDepartmentReviewer = item.RiskDepartmentReviewer;
                    var DepartmentLeader = item.DepartmentLeader;
                    var RiskDepartmentLeader = item.RiskDepartmentLeader;
                    var Chairman = item.Chairman;
                    //获取对应ID
                    var riskDepartmentReviewerId = WfForm.convertFieldNameToId("fxglbshry");
                    var riskDepartmentHeadId = WfForm.convertFieldNameToId("fxglbfzr");
                    var departmentLeaderId = WfForm.convertFieldNameToId("sqbmfgld");
                    var riskDepartmentLeaderId = WfForm.convertFieldNameToId("fxglbfgld");
                    var assetDisposalCommitteeId = WfForm.convertFieldNameToId("zcczwyhsh");
                    var generalManagerId = WfForm.convertFieldNameToId("zjl");
                    var chairmanId = WfForm.convertFieldNameToId("dsc");

                    //修改对应状态
                    if (RiskDepartmentReviewer === true) {
                        WfForm.changeFieldAttr(riskDepartmentReviewerId, 3);
                    }
                    if (RiskDepartmentHead === true) {
                        WfForm.changeFieldAttr(riskDepartmentHeadId, 3);
                    }
                    if (AssetDisposalCommittee === true) {
                        WfForm.changeFieldAttr(assetDisposalCommitteeId, 3);
                    }
                    if (GeneralManager === true) {
                        WfForm.changeFieldAttr(generalManagerId, 3);
                    }
                    if (DepartmentLeader === true) {
                        WfForm.changeFieldAttr(departmentLeaderId, 3);
                    }
                    if (RiskDepartmentLeader === true) {
                        WfForm.changeFieldAttr(riskDepartmentLeaderId, 3);
                    }
                    if (Chairman === true) {
                        WfForm.changeFieldAttr(chairmanId, 3);
                    }
                })
                .cache(() => {
                    alert("运行异常");
                });
            //********************************************************
        });
</script>

